{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyxtal.crystal import random_crystal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "C = random_crystal(227, ['C'], [2], 1.0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "------Random Crystal------\n",
      "Composition: C8\n",
      "Dimension: 3\n",
      "Group: Fd-3m (227)\n",
      "Volume factor: 1.0\n",
      "cubic lattice:   2.9681   2.9681   2.9681  90.0000  90.0000  90.0000\n",
      "Wyckoff sites:\n",
      "\t C @ [0.1250 0.1250 0.1250], WP:  8a, Site symmetry: -4 3 m\n"
     ]
    }
   ],
   "source": [
    "print(C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "application/3dmoljs_load.v0": "<div id=\"3dmolviewer_1600988705716369\"  style=\"position: relative; width: 600px; height: 300px\">\n        <p id=\"3dmolwarning_1600988705716369\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n        </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n  return new Promise((resolve, reject) => {\n    var tag = document.createElement('script');\n    tag.src = uri;\n    tag.async = true;\n    tag.onload = () => {\n      resolve();\n    };\n  var firstScriptTag = document.getElementsByTagName('script')[0];\n  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n}\n\nvar viewer_1600988705716369 = null;\nvar warn = document.getElementById(\"3dmolwarning_1600988705716369\");\nif(warn) {\n    warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_1600988705716369 = $3Dmol.createViewer($(\"#3dmolviewer_1600988705716369\"),{backgroundColor:\"white\"});\n\tviewer_1600988705716369.addModel(\"#############################################################\\n#             ______       _    _          _   \\t            #\\n#            (_____ \\\\     \\\\ \\\\  / /        | |               #\\n#             _____) )   _ \\\\ \\\\/ / |_  ____| |  \\t            #\\n#            |  ____/ | | | )  (|  _)/ _  | | \\t            #\\n#            | |    | |_| |/ /\\\\ \\\\ |_( (_| | |___            #\\n#            |_|     \\\\__  /_/  \\\\_\\\\___)__|_|_____)           #\\n#                   (____/                                  #\\n#---------------------(version    0.0.9)--------------------#\\n#       A Python package for random crystal generation      #\\n#       url: https://github.com/qzhu2017/pyxtal             #\\n#       @Zhu's group at University of Nevada Las Vegas      #\\n#############################################################\\ndata_from_pyxtal\\n\\n_symmetry_space_group_name_H-M 'Fd-3m'\\n_symmetry_Int_Tables_number                  227\\n_symmetry_cell_setting                     cubic\\n_cell_length_a            2.968126\\n_cell_length_b            2.968126\\n_cell_length_c            2.968126\\n_cell_angle_alpha        90.000000\\n_cell_angle_beta         90.000000\\n_cell_angle_gamma        90.000000\\n\\nloop_\\n _symmetry_equiv_pos_site_id\\n _symmetry_equiv_pos_as_xyz\\n1 'x, y, z'\\n2 '-x+3/4, -y+1/4, z+1/2'\\n3 '-x+1/4, y+1/2, -z+3/4'\\n4 'x+1/2, -y+3/4, -z+1/4'\\n5 'z, x, y'\\n6 'z+1/2, -x+3/4, -y+1/4'\\n7 '-z+3/4, -x+1/4, y+1/2'\\n8 '-z+1/4, x+1/2, -y+3/4'\\n9 'y, z, x'\\n10 '-y+1/4, z+1/2, -x+3/4'\\n11 'y+1/2, -z+3/4, -x+1/4'\\n12 '-y+3/4, -z+1/4, x+1/2'\\n13 'y+3/4, x+1/4, -z+1/2'\\n14 '-y, -x, -z'\\n15 'y+1/4, -x+1/2, z+3/4'\\n16 '-y+1/2, x+3/4, z+1/4'\\n17 'x+3/4, z+1/4, -y+1/2'\\n18 '-x+1/2, z+3/4, y+1/4'\\n19 '-x, -z, -y'\\n20 'x+1/4, -z+1/2, y+3/4'\\n21 'z+3/4, y+1/4, -x+1/2'\\n22 'z+1/4, -y+1/2, x+3/4'\\n23 '-z+1/2, y+3/4, x+1/4'\\n24 '-z, -y, -x'\\n25 '-x, -y, -z'\\n26 'x+1/4, y+3/4, -z+1/2'\\n27 'x+3/4, -y+1/2, z+1/4'\\n28 '-x+1/2, y+1/4, z+3/4'\\n29 '-z, -x, -y'\\n30 '-z+1/2, x+1/4, y+3/4'\\n31 'z+1/4, x+3/4, -y+1/2'\\n32 'z+3/4, -x+1/2, y+1/4'\\n33 '-y, -z, -x'\\n34 'y+3/4, -z+1/2, x+1/4'\\n35 '-y+1/2, z+1/4, x+3/4'\\n36 'y+1/4, z+3/4, -x+1/2'\\n37 '-y+1/4, -x+3/4, z+1/2'\\n38 'y, x, z'\\n39 '-y+3/4, x+1/2, -z+1/4'\\n40 'y+1/2, -x+1/4, -z+3/4'\\n41 '-x+1/4, -z+3/4, y+1/2'\\n42 'x+1/2, -z+1/4, -y+3/4'\\n43 'x, z, y'\\n44 '-x+3/4, z+1/2, -y+1/4'\\n45 '-z+1/4, -y+3/4, x+1/2'\\n46 '-z+3/4, y+1/2, -x+1/4'\\n47 'z+1/2, -y+1/4, -x+3/4'\\n48 'z, y, x'\\n49 'x, y+1/2, z+1/2'\\n50 '-x+3/4, -y+3/4, z+1'\\n51 '-x+1/4, y+1, -z+5/4'\\n52 'x+1/2, -y+5/4, -z+3/4'\\n53 'z, x+1/2, y+1/2'\\n54 'z+1/2, -x+5/4, -y+3/4'\\n55 '-z+3/4, -x+3/4, y+1'\\n56 '-z+1/4, x+1, -y+5/4'\\n57 'y, z+1/2, x+1/2'\\n58 '-y+1/4, z+1, -x+5/4'\\n59 'y+1/2, -z+5/4, -x+3/4'\\n60 '-y+3/4, -z+3/4, x+1'\\n61 'y+3/4, x+3/4, -z+1'\\n62 '-y, -x+1/2, -z+1/2'\\n63 'y+1/4, -x+1, z+5/4'\\n64 '-y+1/2, x+5/4, z+3/4'\\n65 'x+3/4, z+3/4, -y+1'\\n66 '-x+1/2, z+5/4, y+3/4'\\n67 '-x, -z+1/2, -y+1/2'\\n68 'x+1/4, -z+1, y+5/4'\\n69 'z+3/4, y+3/4, -x+1'\\n70 'z+1/4, -y+1, x+5/4'\\n71 '-z+1/2, y+5/4, x+3/4'\\n72 '-z, -y+1/2, -x+1/2'\\n73 '-x, -y+1/2, -z+1/2'\\n74 'x+1/4, y+5/4, -z+1'\\n75 'x+3/4, -y+1, z+3/4'\\n76 '-x+1/2, y+3/4, z+5/4'\\n77 '-z, -x+1/2, -y+1/2'\\n78 '-z+1/2, x+3/4, y+5/4'\\n79 'z+1/4, x+5/4, -y+1'\\n80 'z+3/4, -x+1, y+3/4'\\n81 '-y, -z+1/2, -x+1/2'\\n82 'y+3/4, -z+1, x+3/4'\\n83 '-y+1/2, z+3/4, x+5/4'\\n84 'y+1/4, z+5/4, -x+1'\\n85 '-y+1/4, -x+5/4, z+1'\\n86 'y, x+1/2, z+1/2'\\n87 '-y+3/4, x+1, -z+3/4'\\n88 'y+1/2, -x+3/4, -z+5/4'\\n89 '-x+1/4, -z+5/4, y+1'\\n90 'x+1/2, -z+3/4, -y+5/4'\\n91 'x, z+1/2, y+1/2'\\n92 '-x+3/4, z+1, -y+3/4'\\n93 '-z+1/4, -y+5/4, x+1'\\n94 '-z+3/4, y+1, -x+3/4'\\n95 'z+1/2, -y+3/4, -x+5/4'\\n96 'z, y+1/2, x+1/2'\\n97 'x+1/2, y, z+1/2'\\n98 '-x+5/4, -y+1/4, z+1'\\n99 '-x+3/4, y+1/2, -z+5/4'\\n100 'x+1, -y+3/4, -z+3/4'\\n101 'z+1/2, x, y+1/2'\\n102 'z+1, -x+3/4, -y+3/4'\\n103 '-z+5/4, -x+1/4, y+1'\\n104 '-z+3/4, x+1/2, -y+5/4'\\n105 'y+1/2, z, x+1/2'\\n106 '-y+3/4, z+1/2, -x+5/4'\\n107 'y+1, -z+3/4, -x+3/4'\\n108 '-y+5/4, -z+1/4, x+1'\\n109 'y+5/4, x+1/4, -z+1'\\n110 '-y+1/2, -x, -z+1/2'\\n111 'y+3/4, -x+1/2, z+5/4'\\n112 '-y+1, x+3/4, z+3/4'\\n113 'x+5/4, z+1/4, -y+1'\\n114 '-x+1, z+3/4, y+3/4'\\n115 '-x+1/2, -z, -y+1/2'\\n116 'x+3/4, -z+1/2, y+5/4'\\n117 'z+5/4, y+1/4, -x+1'\\n118 'z+3/4, -y+1/2, x+5/4'\\n119 '-z+1, y+3/4, x+3/4'\\n120 '-z+1/2, -y, -x+1/2'\\n121 '-x+1/2, -y, -z+1/2'\\n122 'x+3/4, y+3/4, -z+1'\\n123 'x+5/4, -y+1/2, z+3/4'\\n124 '-x+1, y+1/4, z+5/4'\\n125 '-z+1/2, -x, -y+1/2'\\n126 '-z+1, x+1/4, y+5/4'\\n127 'z+3/4, x+3/4, -y+1'\\n128 'z+5/4, -x+1/2, y+3/4'\\n129 '-y+1/2, -z, -x+1/2'\\n130 'y+5/4, -z+1/2, x+3/4'\\n131 '-y+1, z+1/4, x+5/4'\\n132 'y+3/4, z+3/4, -x+1'\\n133 '-y+3/4, -x+3/4, z+1'\\n134 'y+1/2, x, z+1/2'\\n135 '-y+5/4, x+1/2, -z+3/4'\\n136 'y+1, -x+1/4, -z+5/4'\\n137 '-x+3/4, -z+3/4, y+1'\\n138 'x+1, -z+1/4, -y+5/4'\\n139 'x+1/2, z, y+1/2'\\n140 '-x+5/4, z+1/2, -y+3/4'\\n141 '-z+3/4, -y+3/4, x+1'\\n142 '-z+5/4, y+1/2, -x+3/4'\\n143 'z+1, -y+1/4, -x+5/4'\\n144 'z+1/2, y, x+1/2'\\n145 'x+1/2, y+1/2, z'\\n146 '-x+5/4, -y+3/4, z+1/2'\\n147 '-x+3/4, y+1, -z+3/4'\\n148 'x+1, -y+5/4, -z+1/4'\\n149 'z+1/2, x+1/2, y'\\n150 'z+1, -x+5/4, -y+1/4'\\n151 '-z+5/4, -x+3/4, y+1/2'\\n152 '-z+3/4, x+1, -y+3/4'\\n153 'y+1/2, z+1/2, x'\\n154 '-y+3/4, z+1, -x+3/4'\\n155 'y+1, -z+5/4, -x+1/4'\\n156 '-y+5/4, -z+3/4, x+1/2'\\n157 'y+5/4, x+3/4, -z+1/2'\\n158 '-y+1/2, -x+1/2, -z'\\n159 'y+3/4, -x+1, z+3/4'\\n160 '-y+1, x+5/4, z+1/4'\\n161 'x+5/4, z+3/4, -y+1/2'\\n162 '-x+1, z+5/4, y+1/4'\\n163 '-x+1/2, -z+1/2, -y'\\n164 'x+3/4, -z+1, y+3/4'\\n165 'z+5/4, y+3/4, -x+1/2'\\n166 'z+3/4, -y+1, x+3/4'\\n167 '-z+1, y+5/4, x+1/4'\\n168 '-z+1/2, -y+1/2, -x'\\n169 '-x+1/2, -y+1/2, -z'\\n170 'x+3/4, y+5/4, -z+1/2'\\n171 'x+5/4, -y+1, z+1/4'\\n172 '-x+1, y+3/4, z+3/4'\\n173 '-z+1/2, -x+1/2, -y'\\n174 '-z+1, x+3/4, y+3/4'\\n175 'z+3/4, x+5/4, -y+1/2'\\n176 'z+5/4, -x+1, y+1/4'\\n177 '-y+1/2, -z+1/2, -x'\\n178 'y+5/4, -z+1, x+1/4'\\n179 '-y+1, z+3/4, x+3/4'\\n180 'y+3/4, z+5/4, -x+1/2'\\n181 '-y+3/4, -x+5/4, z+1/2'\\n182 'y+1/2, x+1/2, z'\\n183 '-y+5/4, x+1, -z+1/4'\\n184 'y+1, -x+3/4, -z+3/4'\\n185 '-x+3/4, -z+5/4, y+1/2'\\n186 'x+1, -z+3/4, -y+3/4'\\n187 'x+1/2, z+1/2, y'\\n188 '-x+5/4, z+1, -y+1/4'\\n189 '-z+3/4, -y+5/4, x+1/2'\\n190 '-z+5/4, y+1, -x+1/4'\\n191 'z+1, -y+3/4, -x+3/4'\\n192 'z+1/2, y+1/2, x'\\n\\nloop_\\n _atom_site_label\\n _atom_site_fract_x\\n _atom_site_fract_y\\n _atom_site_fract_z\\n _atom_site_occupancy\\nC           0.125000    0.125000    0.125000 1\\n#END\\n\\n\",\"cif\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n\tviewer_1600988705716369.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.25}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n\tviewer_1600988705716369.addUnitCell();\n\tviewer_1600988705716369.replicateUnitCell(2,2,1);\n\tviewer_1600988705716369.zoomTo();\nviewer_1600988705716369.render();\n});\n</script>",
      "text/html": [
       "<div id=\"3dmolviewer_1600988705716369\"  style=\"position: relative; width: 600px; height: 300px\">\n",
       "        <p id=\"3dmolwarning_1600988705716369\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n",
       "        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
       "        </div>\n",
       "<script>\n",
       "\n",
       "var loadScriptAsync = function(uri){\n",
       "  return new Promise((resolve, reject) => {\n",
       "    var tag = document.createElement('script');\n",
       "    tag.src = uri;\n",
       "    tag.async = true;\n",
       "    tag.onload = () => {\n",
       "      resolve();\n",
       "    };\n",
       "  var firstScriptTag = document.getElementsByTagName('script')[0];\n",
       "  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
       "});\n",
       "};\n",
       "\n",
       "if(typeof $3Dmolpromise === 'undefined') {\n",
       "$3Dmolpromise = null;\n",
       "  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n",
       "}\n",
       "\n",
       "var viewer_1600988705716369 = null;\n",
       "var warn = document.getElementById(\"3dmolwarning_1600988705716369\");\n",
       "if(warn) {\n",
       "    warn.parentNode.removeChild(warn);\n",
       "}\n",
       "$3Dmolpromise.then(function() {\n",
       "viewer_1600988705716369 = $3Dmol.createViewer($(\"#3dmolviewer_1600988705716369\"),{backgroundColor:\"white\"});\n",
       "\tviewer_1600988705716369.addModel(\"#############################################################\\n#             ______       _    _          _   \\t            #\\n#            (_____ \\\\     \\\\ \\\\  / /        | |               #\\n#             _____) )   _ \\\\ \\\\/ / |_  ____| |  \\t            #\\n#            |  ____/ | | | )  (|  _)/ _  | | \\t            #\\n#            | |    | |_| |/ /\\\\ \\\\ |_( (_| | |___            #\\n#            |_|     \\\\__  /_/  \\\\_\\\\___)__|_|_____)           #\\n#                   (____/                                  #\\n#---------------------(version    0.0.9)--------------------#\\n#       A Python package for random crystal generation      #\\n#       url: https://github.com/qzhu2017/pyxtal             #\\n#       @Zhu's group at University of Nevada Las Vegas      #\\n#############################################################\\ndata_from_pyxtal\\n\\n_symmetry_space_group_name_H-M 'Fd-3m'\\n_symmetry_Int_Tables_number                  227\\n_symmetry_cell_setting                     cubic\\n_cell_length_a            2.968126\\n_cell_length_b            2.968126\\n_cell_length_c            2.968126\\n_cell_angle_alpha        90.000000\\n_cell_angle_beta         90.000000\\n_cell_angle_gamma        90.000000\\n\\nloop_\\n _symmetry_equiv_pos_site_id\\n _symmetry_equiv_pos_as_xyz\\n1 'x, y, z'\\n2 '-x+3/4, -y+1/4, z+1/2'\\n3 '-x+1/4, y+1/2, -z+3/4'\\n4 'x+1/2, -y+3/4, -z+1/4'\\n5 'z, x, y'\\n6 'z+1/2, -x+3/4, -y+1/4'\\n7 '-z+3/4, -x+1/4, y+1/2'\\n8 '-z+1/4, x+1/2, -y+3/4'\\n9 'y, z, x'\\n10 '-y+1/4, z+1/2, -x+3/4'\\n11 'y+1/2, -z+3/4, -x+1/4'\\n12 '-y+3/4, -z+1/4, x+1/2'\\n13 'y+3/4, x+1/4, -z+1/2'\\n14 '-y, -x, -z'\\n15 'y+1/4, -x+1/2, z+3/4'\\n16 '-y+1/2, x+3/4, z+1/4'\\n17 'x+3/4, z+1/4, -y+1/2'\\n18 '-x+1/2, z+3/4, y+1/4'\\n19 '-x, -z, -y'\\n20 'x+1/4, -z+1/2, y+3/4'\\n21 'z+3/4, y+1/4, -x+1/2'\\n22 'z+1/4, -y+1/2, x+3/4'\\n23 '-z+1/2, y+3/4, x+1/4'\\n24 '-z, -y, -x'\\n25 '-x, -y, -z'\\n26 'x+1/4, y+3/4, -z+1/2'\\n27 'x+3/4, -y+1/2, z+1/4'\\n28 '-x+1/2, y+1/4, z+3/4'\\n29 '-z, -x, -y'\\n30 '-z+1/2, x+1/4, y+3/4'\\n31 'z+1/4, x+3/4, -y+1/2'\\n32 'z+3/4, -x+1/2, y+1/4'\\n33 '-y, -z, -x'\\n34 'y+3/4, -z+1/2, x+1/4'\\n35 '-y+1/2, z+1/4, x+3/4'\\n36 'y+1/4, z+3/4, -x+1/2'\\n37 '-y+1/4, -x+3/4, z+1/2'\\n38 'y, x, z'\\n39 '-y+3/4, x+1/2, -z+1/4'\\n40 'y+1/2, -x+1/4, -z+3/4'\\n41 '-x+1/4, -z+3/4, y+1/2'\\n42 'x+1/2, -z+1/4, -y+3/4'\\n43 'x, z, y'\\n44 '-x+3/4, z+1/2, -y+1/4'\\n45 '-z+1/4, -y+3/4, x+1/2'\\n46 '-z+3/4, y+1/2, -x+1/4'\\n47 'z+1/2, -y+1/4, -x+3/4'\\n48 'z, y, x'\\n49 'x, y+1/2, z+1/2'\\n50 '-x+3/4, -y+3/4, z+1'\\n51 '-x+1/4, y+1, -z+5/4'\\n52 'x+1/2, -y+5/4, -z+3/4'\\n53 'z, x+1/2, y+1/2'\\n54 'z+1/2, -x+5/4, -y+3/4'\\n55 '-z+3/4, -x+3/4, y+1'\\n56 '-z+1/4, x+1, -y+5/4'\\n57 'y, z+1/2, x+1/2'\\n58 '-y+1/4, z+1, -x+5/4'\\n59 'y+1/2, -z+5/4, -x+3/4'\\n60 '-y+3/4, -z+3/4, x+1'\\n61 'y+3/4, x+3/4, -z+1'\\n62 '-y, -x+1/2, -z+1/2'\\n63 'y+1/4, -x+1, z+5/4'\\n64 '-y+1/2, x+5/4, z+3/4'\\n65 'x+3/4, z+3/4, -y+1'\\n66 '-x+1/2, z+5/4, y+3/4'\\n67 '-x, -z+1/2, -y+1/2'\\n68 'x+1/4, -z+1, y+5/4'\\n69 'z+3/4, y+3/4, -x+1'\\n70 'z+1/4, -y+1, x+5/4'\\n71 '-z+1/2, y+5/4, x+3/4'\\n72 '-z, -y+1/2, -x+1/2'\\n73 '-x, -y+1/2, -z+1/2'\\n74 'x+1/4, y+5/4, -z+1'\\n75 'x+3/4, -y+1, z+3/4'\\n76 '-x+1/2, y+3/4, z+5/4'\\n77 '-z, -x+1/2, -y+1/2'\\n78 '-z+1/2, x+3/4, y+5/4'\\n79 'z+1/4, x+5/4, -y+1'\\n80 'z+3/4, -x+1, y+3/4'\\n81 '-y, -z+1/2, -x+1/2'\\n82 'y+3/4, -z+1, x+3/4'\\n83 '-y+1/2, z+3/4, x+5/4'\\n84 'y+1/4, z+5/4, -x+1'\\n85 '-y+1/4, -x+5/4, z+1'\\n86 'y, x+1/2, z+1/2'\\n87 '-y+3/4, x+1, -z+3/4'\\n88 'y+1/2, -x+3/4, -z+5/4'\\n89 '-x+1/4, -z+5/4, y+1'\\n90 'x+1/2, -z+3/4, -y+5/4'\\n91 'x, z+1/2, y+1/2'\\n92 '-x+3/4, z+1, -y+3/4'\\n93 '-z+1/4, -y+5/4, x+1'\\n94 '-z+3/4, y+1, -x+3/4'\\n95 'z+1/2, -y+3/4, -x+5/4'\\n96 'z, y+1/2, x+1/2'\\n97 'x+1/2, y, z+1/2'\\n98 '-x+5/4, -y+1/4, z+1'\\n99 '-x+3/4, y+1/2, -z+5/4'\\n100 'x+1, -y+3/4, -z+3/4'\\n101 'z+1/2, x, y+1/2'\\n102 'z+1, -x+3/4, -y+3/4'\\n103 '-z+5/4, -x+1/4, y+1'\\n104 '-z+3/4, x+1/2, -y+5/4'\\n105 'y+1/2, z, x+1/2'\\n106 '-y+3/4, z+1/2, -x+5/4'\\n107 'y+1, -z+3/4, -x+3/4'\\n108 '-y+5/4, -z+1/4, x+1'\\n109 'y+5/4, x+1/4, -z+1'\\n110 '-y+1/2, -x, -z+1/2'\\n111 'y+3/4, -x+1/2, z+5/4'\\n112 '-y+1, x+3/4, z+3/4'\\n113 'x+5/4, z+1/4, -y+1'\\n114 '-x+1, z+3/4, y+3/4'\\n115 '-x+1/2, -z, -y+1/2'\\n116 'x+3/4, -z+1/2, y+5/4'\\n117 'z+5/4, y+1/4, -x+1'\\n118 'z+3/4, -y+1/2, x+5/4'\\n119 '-z+1, y+3/4, x+3/4'\\n120 '-z+1/2, -y, -x+1/2'\\n121 '-x+1/2, -y, -z+1/2'\\n122 'x+3/4, y+3/4, -z+1'\\n123 'x+5/4, -y+1/2, z+3/4'\\n124 '-x+1, y+1/4, z+5/4'\\n125 '-z+1/2, -x, -y+1/2'\\n126 '-z+1, x+1/4, y+5/4'\\n127 'z+3/4, x+3/4, -y+1'\\n128 'z+5/4, -x+1/2, y+3/4'\\n129 '-y+1/2, -z, -x+1/2'\\n130 'y+5/4, -z+1/2, x+3/4'\\n131 '-y+1, z+1/4, x+5/4'\\n132 'y+3/4, z+3/4, -x+1'\\n133 '-y+3/4, -x+3/4, z+1'\\n134 'y+1/2, x, z+1/2'\\n135 '-y+5/4, x+1/2, -z+3/4'\\n136 'y+1, -x+1/4, -z+5/4'\\n137 '-x+3/4, -z+3/4, y+1'\\n138 'x+1, -z+1/4, -y+5/4'\\n139 'x+1/2, z, y+1/2'\\n140 '-x+5/4, z+1/2, -y+3/4'\\n141 '-z+3/4, -y+3/4, x+1'\\n142 '-z+5/4, y+1/2, -x+3/4'\\n143 'z+1, -y+1/4, -x+5/4'\\n144 'z+1/2, y, x+1/2'\\n145 'x+1/2, y+1/2, z'\\n146 '-x+5/4, -y+3/4, z+1/2'\\n147 '-x+3/4, y+1, -z+3/4'\\n148 'x+1, -y+5/4, -z+1/4'\\n149 'z+1/2, x+1/2, y'\\n150 'z+1, -x+5/4, -y+1/4'\\n151 '-z+5/4, -x+3/4, y+1/2'\\n152 '-z+3/4, x+1, -y+3/4'\\n153 'y+1/2, z+1/2, x'\\n154 '-y+3/4, z+1, -x+3/4'\\n155 'y+1, -z+5/4, -x+1/4'\\n156 '-y+5/4, -z+3/4, x+1/2'\\n157 'y+5/4, x+3/4, -z+1/2'\\n158 '-y+1/2, -x+1/2, -z'\\n159 'y+3/4, -x+1, z+3/4'\\n160 '-y+1, x+5/4, z+1/4'\\n161 'x+5/4, z+3/4, -y+1/2'\\n162 '-x+1, z+5/4, y+1/4'\\n163 '-x+1/2, -z+1/2, -y'\\n164 'x+3/4, -z+1, y+3/4'\\n165 'z+5/4, y+3/4, -x+1/2'\\n166 'z+3/4, -y+1, x+3/4'\\n167 '-z+1, y+5/4, x+1/4'\\n168 '-z+1/2, -y+1/2, -x'\\n169 '-x+1/2, -y+1/2, -z'\\n170 'x+3/4, y+5/4, -z+1/2'\\n171 'x+5/4, -y+1, z+1/4'\\n172 '-x+1, y+3/4, z+3/4'\\n173 '-z+1/2, -x+1/2, -y'\\n174 '-z+1, x+3/4, y+3/4'\\n175 'z+3/4, x+5/4, -y+1/2'\\n176 'z+5/4, -x+1, y+1/4'\\n177 '-y+1/2, -z+1/2, -x'\\n178 'y+5/4, -z+1, x+1/4'\\n179 '-y+1, z+3/4, x+3/4'\\n180 'y+3/4, z+5/4, -x+1/2'\\n181 '-y+3/4, -x+5/4, z+1/2'\\n182 'y+1/2, x+1/2, z'\\n183 '-y+5/4, x+1, -z+1/4'\\n184 'y+1, -x+3/4, -z+3/4'\\n185 '-x+3/4, -z+5/4, y+1/2'\\n186 'x+1, -z+3/4, -y+3/4'\\n187 'x+1/2, z+1/2, y'\\n188 '-x+5/4, z+1, -y+1/4'\\n189 '-z+3/4, -y+5/4, x+1/2'\\n190 '-z+5/4, y+1, -x+1/4'\\n191 'z+1, -y+3/4, -x+3/4'\\n192 'z+1/2, y+1/2, x'\\n\\nloop_\\n _atom_site_label\\n _atom_site_fract_x\\n _atom_site_fract_y\\n _atom_site_fract_z\\n _atom_site_occupancy\\nC           0.125000    0.125000    0.125000 1\\n#END\\n\\n\",\"cif\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n",
       "\tviewer_1600988705716369.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.25}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n",
       "\tviewer_1600988705716369.addUnitCell();\n",
       "\tviewer_1600988705716369.replicateUnitCell(2,2,1);\n",
       "\tviewer_1600988705716369.zoomTo();\n",
       "viewer_1600988705716369.render();\n",
       "});\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<py3Dmol.view at 0x7fe58299c950>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#display the structure can be easily accessed with the show() function\n",
    "C.show(supercell=(2,2,1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "#the structure can be dumped as cif format\n",
    "#C.to_file('c-diamond.cif')\n",
    "\n",
    "#if you want to look how it looks like\n",
    "#print(C.to_file())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Atoms(symbols='C8', pbc=True, cell=[[2.9681263621648797, 0.0, 0.0], [1.8174532244450487e-16, 2.9681263621648797, 0.0], [1.8174532244450487e-16, 1.8174532244450487e-16, 2.9681263621648797]])\n",
      "Full Formula (C8)\n",
      "Reduced Formula: C\n",
      "abc   :   2.968126   2.968126   2.968126\n",
      "angles:  90.000000  90.000000  90.000000\n",
      "Sites (8)\n",
      "  #  SP        a      b      c\n",
      "---  ----  -----  -----  -----\n",
      "  0  C     0.125  0.125  0.125\n",
      "  1  C     0.875  0.375  0.375\n",
      "  2  C     0.125  0.625  0.625\n",
      "  3  C     0.875  0.875  0.875\n",
      "  4  C     0.625  0.125  0.625\n",
      "  5  C     1.375  0.375  0.875\n",
      "  6  C     0.625  0.625  0.125\n",
      "  7  C     1.375  0.875  0.375\n"
     ]
    }
   ],
   "source": [
    "#Alternatively, you can export the structure to ASE or pymatgen\n",
    "ase_struc = C.to_ase()\n",
    "print(ase_struc)\n",
    "pmg_struc = C.to_pymatgen()\n",
    "print(pmg_struc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/3dmoljs_load.v0": "<div id=\"3dmolviewer_16009887058699331\"  style=\"position: relative; width: 600px; height: 300px\">\n        <p id=\"3dmolwarning_16009887058699331\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n        </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n  return new Promise((resolve, reject) => {\n    var tag = document.createElement('script');\n    tag.src = uri;\n    tag.async = true;\n    tag.onload = () => {\n      resolve();\n    };\n  var firstScriptTag = document.getElementsByTagName('script')[0];\n  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n}\n\nvar viewer_16009887058699331 = null;\nvar warn = document.getElementById(\"3dmolwarning_16009887058699331\");\nif(warn) {\n    warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_16009887058699331 = $3Dmol.createViewer($(\"#3dmolviewer_16009887058699331\"),{backgroundColor:\"white\"});\n\tviewer_16009887058699331.addModel(\"# generated using pymatgen\\ndata_C\\n_symmetry_space_group_name_H-M   'P 1'\\n_cell_length_a   4.03555723\\n_cell_length_b   4.03555723\\n_cell_length_c   18.00000000\\n_cell_angle_alpha   90.00000000\\n_cell_angle_beta   90.00000000\\n_cell_angle_gamma   120.00000000\\n_symmetry_Int_Tables_number   1\\n_chemical_formula_structural   C\\n_chemical_formula_sum   C6\\n_cell_volume   253.86928357\\n_cell_formula_units_Z   6\\nloop_\\n _symmetry_equiv_pos_site_id\\n _symmetry_equiv_pos_as_xyz\\n  1  'x, y, z'\\nloop_\\n _atom_site_type_symbol\\n _atom_site_label\\n _atom_site_symmetry_multiplicity\\n _atom_site_fract_x\\n _atom_site_fract_y\\n _atom_site_fract_z\\n _atom_site_occupancy\\n  C  C0  1  0.42415790  0.13785885  0.41666667  1\\n  C  C1  1  -0.13785885  0.28629905  0.41666667  1\\n  C  C2  1  -0.28629905  -0.42415790  0.41666667  1\\n  C  C3  1  -0.42415790  -0.13785885  0.41666667  1\\n  C  C4  1  0.13785885  -0.28629905  0.41666667  1\\n  C  C5  1  0.28629905  0.42415790  0.41666667  1\\n\",\"cif\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n\tviewer_16009887058699331.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n\tviewer_16009887058699331.addUnitCell();\n\tviewer_16009887058699331.replicateUnitCell(1,1,1);\n\tviewer_16009887058699331.zoomTo();\nviewer_16009887058699331.render();\n});\n</script>",
      "text/html": [
       "<div id=\"3dmolviewer_16009887058699331\"  style=\"position: relative; width: 600px; height: 300px\">\n",
       "        <p id=\"3dmolwarning_16009887058699331\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n",
       "        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
       "        </div>\n",
       "<script>\n",
       "\n",
       "var loadScriptAsync = function(uri){\n",
       "  return new Promise((resolve, reject) => {\n",
       "    var tag = document.createElement('script');\n",
       "    tag.src = uri;\n",
       "    tag.async = true;\n",
       "    tag.onload = () => {\n",
       "      resolve();\n",
       "    };\n",
       "  var firstScriptTag = document.getElementsByTagName('script')[0];\n",
       "  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
       "});\n",
       "};\n",
       "\n",
       "if(typeof $3Dmolpromise === 'undefined') {\n",
       "$3Dmolpromise = null;\n",
       "  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n",
       "}\n",
       "\n",
       "var viewer_16009887058699331 = null;\n",
       "var warn = document.getElementById(\"3dmolwarning_16009887058699331\");\n",
       "if(warn) {\n",
       "    warn.parentNode.removeChild(warn);\n",
       "}\n",
       "$3Dmolpromise.then(function() {\n",
       "viewer_16009887058699331 = $3Dmol.createViewer($(\"#3dmolviewer_16009887058699331\"),{backgroundColor:\"white\"});\n",
       "\tviewer_16009887058699331.addModel(\"# generated using pymatgen\\ndata_C\\n_symmetry_space_group_name_H-M   'P 1'\\n_cell_length_a   4.03555723\\n_cell_length_b   4.03555723\\n_cell_length_c   18.00000000\\n_cell_angle_alpha   90.00000000\\n_cell_angle_beta   90.00000000\\n_cell_angle_gamma   120.00000000\\n_symmetry_Int_Tables_number   1\\n_chemical_formula_structural   C\\n_chemical_formula_sum   C6\\n_cell_volume   253.86928357\\n_cell_formula_units_Z   6\\nloop_\\n _symmetry_equiv_pos_site_id\\n _symmetry_equiv_pos_as_xyz\\n  1  'x, y, z'\\nloop_\\n _atom_site_type_symbol\\n _atom_site_label\\n _atom_site_symmetry_multiplicity\\n _atom_site_fract_x\\n _atom_site_fract_y\\n _atom_site_fract_z\\n _atom_site_occupancy\\n  C  C0  1  0.42415790  0.13785885  0.41666667  1\\n  C  C1  1  -0.13785885  0.28629905  0.41666667  1\\n  C  C2  1  -0.28629905  -0.42415790  0.41666667  1\\n  C  C3  1  -0.42415790  -0.13785885  0.41666667  1\\n  C  C4  1  0.13785885  -0.28629905  0.41666667  1\\n  C  C5  1  0.28629905  0.42415790  0.41666667  1\\n\",\"cif\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n",
       "\tviewer_16009887058699331.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n",
       "\tviewer_16009887058699331.addUnitCell();\n",
       "\tviewer_16009887058699331.replicateUnitCell(1,1,1);\n",
       "\tviewer_16009887058699331.zoomTo();\n",
       "viewer_16009887058699331.render();\n",
       "});\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<py3Dmol.view at 0x7fe5829e20d0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyxtal.crystal import random_crystal_2D\n",
    "C = random_crystal_2D(75, ['C'], [6], thickness=0.0)\n",
    "C.show(scale=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/3dmoljs_load.v0": "<div id=\"3dmolviewer_1600988707972131\"  style=\"position: relative; width: 600px; height: 300px\">\n        <p id=\"3dmolwarning_1600988707972131\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n        </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n  return new Promise((resolve, reject) => {\n    var tag = document.createElement('script');\n    tag.src = uri;\n    tag.async = true;\n    tag.onload = () => {\n      resolve();\n    };\n  var firstScriptTag = document.getElementsByTagName('script')[0];\n  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n}\n\nvar viewer_1600988707972131 = null;\nvar warn = document.getElementById(\"3dmolwarning_1600988707972131\");\nif(warn) {\n    warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_1600988707972131 = $3Dmol.createViewer($(\"#3dmolviewer_1600988707972131\"),{backgroundColor:\"white\"});\n\tviewer_1600988707972131.addModel(\"60\\nC60\\nC -0.000000 0.309042 -2.350163\\nC -0.925061 0.880761 -1.996821\\nC 1.425102 0.571719 1.805823\\nC 1.425102 -0.571719 1.805823\\nC -0.880761 1.996821 0.925061\\nC 0.925061 -0.880761 1.996821\\nC -0.571719 -1.805823 -1.425102\\nC 0.880761 1.996821 -0.925061\\nC 1.805823 -1.425102 0.571719\\nC 1.425102 0.571719 -1.805823\\nC -0.571719 1.805823 -1.425102\\nC 0.000000 0.309042 2.350163\\nC 2.350163 0.000000 0.309042\\nC 1.996821 -0.925061 0.880761\\nC 0.000000 -0.309042 2.350163\\nC -2.350163 0.000000 0.309042\\nC -1.996821 0.925061 0.880761\\nC -0.880761 1.996821 -0.925061\\nC -0.925061 -0.880761 1.996821\\nC 0.925061 0.880761 -1.996821\\nC 0.571719 -1.805823 1.425102\\nC -1.805823 -1.425102 -0.571719\\nC -1.805823 -1.425102 0.571719\\nC 0.571719 -1.805823 -1.425102\\nC -1.425102 -0.571719 1.805823\\nC -1.425102 0.571719 1.805823\\nC 0.571719 1.805823 1.425102\\nC 0.880761 -1.996821 -0.925061\\nC 0.925061 0.880761 1.996821\\nC -0.925061 -0.880761 -1.996821\\nC -0.880761 -1.996821 0.925061\\nC -0.000000 -0.309042 -2.350163\\nC 2.350163 -0.000000 -0.309042\\nC 0.309042 2.350163 0.000000\\nC 1.425102 -0.571719 -1.805823\\nC -1.805823 1.425102 -0.571719\\nC 1.996821 -0.925061 -0.880761\\nC -2.350163 -0.000000 -0.309042\\nC -0.309042 -2.350163 0.000000\\nC -0.880761 -1.996821 -0.925061\\nC -1.805823 1.425102 0.571719\\nC 0.880761 1.996821 0.925061\\nC 0.925061 -0.880761 -1.996821\\nC -1.425102 -0.571719 -1.805823\\nC -1.425102 0.571719 -1.805823\\nC 1.805823 -1.425102 -0.571719\\nC -1.996821 0.925061 -0.880761\\nC 0.309042 -2.350163 0.000000\\nC 0.880761 -1.996821 0.925061\\nC -0.309042 2.350163 0.000000\\nC -0.925061 0.880761 1.996821\\nC 0.571719 1.805823 -1.425102\\nC -0.571719 -1.805823 1.425102\\nC -1.996821 -0.925061 0.880761\\nC 1.805823 1.425102 0.571719\\nC 1.805823 1.425102 -0.571719\\nC -0.571719 1.805823 1.425102\\nC 1.996821 0.925061 0.880761\\nC 1.996821 0.925061 -0.880761\\nC -1.996821 -0.925061 -0.880761\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n\tviewer_1600988707972131.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n\tviewer_1600988707972131.zoomTo();\nviewer_1600988707972131.render();\n});\n</script>",
      "text/html": [
       "<div id=\"3dmolviewer_1600988707972131\"  style=\"position: relative; width: 600px; height: 300px\">\n",
       "        <p id=\"3dmolwarning_1600988707972131\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n",
       "        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
       "        </div>\n",
       "<script>\n",
       "\n",
       "var loadScriptAsync = function(uri){\n",
       "  return new Promise((resolve, reject) => {\n",
       "    var tag = document.createElement('script');\n",
       "    tag.src = uri;\n",
       "    tag.async = true;\n",
       "    tag.onload = () => {\n",
       "      resolve();\n",
       "    };\n",
       "  var firstScriptTag = document.getElementsByTagName('script')[0];\n",
       "  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
       "});\n",
       "};\n",
       "\n",
       "if(typeof $3Dmolpromise === 'undefined') {\n",
       "$3Dmolpromise = null;\n",
       "  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n",
       "}\n",
       "\n",
       "var viewer_1600988707972131 = null;\n",
       "var warn = document.getElementById(\"3dmolwarning_1600988707972131\");\n",
       "if(warn) {\n",
       "    warn.parentNode.removeChild(warn);\n",
       "}\n",
       "$3Dmolpromise.then(function() {\n",
       "viewer_1600988707972131 = $3Dmol.createViewer($(\"#3dmolviewer_1600988707972131\"),{backgroundColor:\"white\"});\n",
       "\tviewer_1600988707972131.addModel(\"60\\nC60\\nC -0.000000 0.309042 -2.350163\\nC -0.925061 0.880761 -1.996821\\nC 1.425102 0.571719 1.805823\\nC 1.425102 -0.571719 1.805823\\nC -0.880761 1.996821 0.925061\\nC 0.925061 -0.880761 1.996821\\nC -0.571719 -1.805823 -1.425102\\nC 0.880761 1.996821 -0.925061\\nC 1.805823 -1.425102 0.571719\\nC 1.425102 0.571719 -1.805823\\nC -0.571719 1.805823 -1.425102\\nC 0.000000 0.309042 2.350163\\nC 2.350163 0.000000 0.309042\\nC 1.996821 -0.925061 0.880761\\nC 0.000000 -0.309042 2.350163\\nC -2.350163 0.000000 0.309042\\nC -1.996821 0.925061 0.880761\\nC -0.880761 1.996821 -0.925061\\nC -0.925061 -0.880761 1.996821\\nC 0.925061 0.880761 -1.996821\\nC 0.571719 -1.805823 1.425102\\nC -1.805823 -1.425102 -0.571719\\nC -1.805823 -1.425102 0.571719\\nC 0.571719 -1.805823 -1.425102\\nC -1.425102 -0.571719 1.805823\\nC -1.425102 0.571719 1.805823\\nC 0.571719 1.805823 1.425102\\nC 0.880761 -1.996821 -0.925061\\nC 0.925061 0.880761 1.996821\\nC -0.925061 -0.880761 -1.996821\\nC -0.880761 -1.996821 0.925061\\nC -0.000000 -0.309042 -2.350163\\nC 2.350163 -0.000000 -0.309042\\nC 0.309042 2.350163 0.000000\\nC 1.425102 -0.571719 -1.805823\\nC -1.805823 1.425102 -0.571719\\nC 1.996821 -0.925061 -0.880761\\nC -2.350163 -0.000000 -0.309042\\nC -0.309042 -2.350163 0.000000\\nC -0.880761 -1.996821 -0.925061\\nC -1.805823 1.425102 0.571719\\nC 0.880761 1.996821 0.925061\\nC 0.925061 -0.880761 -1.996821\\nC -1.425102 -0.571719 -1.805823\\nC -1.425102 0.571719 -1.805823\\nC 1.805823 -1.425102 -0.571719\\nC -1.996821 0.925061 -0.880761\\nC 0.309042 -2.350163 0.000000\\nC 0.880761 -1.996821 0.925061\\nC -0.309042 2.350163 0.000000\\nC -0.925061 0.880761 1.996821\\nC 0.571719 1.805823 -1.425102\\nC -0.571719 -1.805823 1.425102\\nC -1.996821 -0.925061 0.880761\\nC 1.805823 1.425102 0.571719\\nC 1.805823 1.425102 -0.571719\\nC -0.571719 1.805823 1.425102\\nC 1.996821 0.925061 0.880761\\nC 1.996821 0.925061 -0.880761\\nC -1.996821 -0.925061 -0.880761\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n",
       "\tviewer_1600988707972131.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.1}});\n",
       "\tviewer_1600988707972131.zoomTo();\n",
       "viewer_1600988707972131.render();\n",
       "});\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<py3Dmol.view at 0x7fe582281e90>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyxtal.crystal import random_cluster\n",
    "C60 = random_cluster('Ih', ['C'], [60], 1.0)\n",
    "C60.show(scale=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/3dmoljs_load.v0": "<div id=\"3dmolviewer_16009887081744692\"  style=\"position: relative; width: 600px; height: 300px\">\n        <p id=\"3dmolwarning_16009887081744692\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n        </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n  return new Promise((resolve, reject) => {\n    var tag = document.createElement('script');\n    tag.src = uri;\n    tag.async = true;\n    tag.onload = () => {\n      resolve();\n    };\n  var firstScriptTag = document.getElementsByTagName('script')[0];\n  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n}\n\nvar viewer_16009887081744692 = null;\nvar warn = document.getElementById(\"3dmolwarning_16009887081744692\");\nif(warn) {\n    warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_16009887081744692 = $3Dmol.createViewer($(\"#3dmolviewer_16009887081744692\"),{backgroundColor:\"white\"});\n\tviewer_16009887081744692.addModel(\"60\\nC60\\nC -0.000000 0.653935 -2.960803\\nC -0.951357 1.241906 -2.597417\\nC 2.009446 0.587971 2.193263\\nC 2.009446 -0.587971 2.193263\\nC -1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 2.597417\\nC -0.587971 -2.193263 -2.009446\\nC 1.241906 2.597417 -0.951357\\nC 2.193263 -2.009446 0.587971\\nC 2.009446 0.587971 -2.193263\\nC -0.587971 2.193263 -2.009446\\nC 0.000000 0.653935 2.960803\\nC 2.960803 0.000000 0.653935\\nC 2.597417 -0.951357 1.241906\\nC 0.000000 -0.653935 2.960803\\nC -2.960803 0.000000 0.653935\\nC -2.597417 0.951357 1.241906\\nC -1.241906 2.597417 -0.951357\\nC -0.951357 -1.241906 2.597417\\nC 0.951357 1.241906 -2.597417\\nC 0.587971 -2.193263 2.009446\\nC -2.193263 -2.009446 -0.587971\\nC -2.193263 -2.009446 0.587971\\nC 0.587971 -2.193263 -2.009446\\nC -2.009446 -0.587971 2.193263\\nC -2.009446 0.587971 2.193263\\nC 0.587971 2.193263 2.009446\\nC 1.241906 -2.597417 -0.951357\\nC 0.951357 1.241906 2.597417\\nC -0.951357 -1.241906 -2.597417\\nC -1.241906 -2.597417 0.951357\\nC -0.000000 -0.653935 -2.960803\\nC 2.960803 -0.000000 -0.653935\\nC 0.653935 2.960803 0.000000\\nC 2.009446 -0.587971 -2.193263\\nC -2.193263 2.009446 -0.587971\\nC 2.597417 -0.951357 -1.241906\\nC -2.960803 -0.000000 -0.653935\\nC -0.653935 -2.960803 0.000000\\nC -1.241906 -2.597417 -0.951357\\nC -2.193263 2.009446 0.587971\\nC 1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 -2.597417\\nC -2.009446 -0.587971 -2.193263\\nC -2.009446 0.587971 -2.193263\\nC 2.193263 -2.009446 -0.587971\\nC -2.597417 0.951357 -1.241906\\nC 0.653935 -2.960803 0.000000\\nC 1.241906 -2.597417 0.951357\\nC -0.653935 2.960803 0.000000\\nC -0.951357 1.241906 2.597417\\nC 0.587971 2.193263 -2.009446\\nC -0.587971 -2.193263 2.009446\\nC -2.597417 -0.951357 1.241906\\nC 2.193263 2.009446 0.587971\\nC 2.193263 2.009446 -0.587971\\nC -0.587971 2.193263 2.009446\\nC 2.597417 0.951357 1.241906\\nC 2.597417 0.951357 -1.241906\\nC -2.597417 -0.951357 -1.241906\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n\tviewer_16009887081744692.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.01}});\n\tviewer_16009887081744692.zoomTo();\nviewer_16009887081744692.render();\n});\n</script>",
      "text/html": [
       "<div id=\"3dmolviewer_16009887081744692\"  style=\"position: relative; width: 600px; height: 300px\">\n",
       "        <p id=\"3dmolwarning_16009887081744692\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n",
       "        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
       "        </div>\n",
       "<script>\n",
       "\n",
       "var loadScriptAsync = function(uri){\n",
       "  return new Promise((resolve, reject) => {\n",
       "    var tag = document.createElement('script');\n",
       "    tag.src = uri;\n",
       "    tag.async = true;\n",
       "    tag.onload = () => {\n",
       "      resolve();\n",
       "    };\n",
       "  var firstScriptTag = document.getElementsByTagName('script')[0];\n",
       "  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
       "});\n",
       "};\n",
       "\n",
       "if(typeof $3Dmolpromise === 'undefined') {\n",
       "$3Dmolpromise = null;\n",
       "  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n",
       "}\n",
       "\n",
       "var viewer_16009887081744692 = null;\n",
       "var warn = document.getElementById(\"3dmolwarning_16009887081744692\");\n",
       "if(warn) {\n",
       "    warn.parentNode.removeChild(warn);\n",
       "}\n",
       "$3Dmolpromise.then(function() {\n",
       "viewer_16009887081744692 = $3Dmol.createViewer($(\"#3dmolviewer_16009887081744692\"),{backgroundColor:\"white\"});\n",
       "\tviewer_16009887081744692.addModel(\"60\\nC60\\nC -0.000000 0.653935 -2.960803\\nC -0.951357 1.241906 -2.597417\\nC 2.009446 0.587971 2.193263\\nC 2.009446 -0.587971 2.193263\\nC -1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 2.597417\\nC -0.587971 -2.193263 -2.009446\\nC 1.241906 2.597417 -0.951357\\nC 2.193263 -2.009446 0.587971\\nC 2.009446 0.587971 -2.193263\\nC -0.587971 2.193263 -2.009446\\nC 0.000000 0.653935 2.960803\\nC 2.960803 0.000000 0.653935\\nC 2.597417 -0.951357 1.241906\\nC 0.000000 -0.653935 2.960803\\nC -2.960803 0.000000 0.653935\\nC -2.597417 0.951357 1.241906\\nC -1.241906 2.597417 -0.951357\\nC -0.951357 -1.241906 2.597417\\nC 0.951357 1.241906 -2.597417\\nC 0.587971 -2.193263 2.009446\\nC -2.193263 -2.009446 -0.587971\\nC -2.193263 -2.009446 0.587971\\nC 0.587971 -2.193263 -2.009446\\nC -2.009446 -0.587971 2.193263\\nC -2.009446 0.587971 2.193263\\nC 0.587971 2.193263 2.009446\\nC 1.241906 -2.597417 -0.951357\\nC 0.951357 1.241906 2.597417\\nC -0.951357 -1.241906 -2.597417\\nC -1.241906 -2.597417 0.951357\\nC -0.000000 -0.653935 -2.960803\\nC 2.960803 -0.000000 -0.653935\\nC 0.653935 2.960803 0.000000\\nC 2.009446 -0.587971 -2.193263\\nC -2.193263 2.009446 -0.587971\\nC 2.597417 -0.951357 -1.241906\\nC -2.960803 -0.000000 -0.653935\\nC -0.653935 -2.960803 0.000000\\nC -1.241906 -2.597417 -0.951357\\nC -2.193263 2.009446 0.587971\\nC 1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 -2.597417\\nC -2.009446 -0.587971 -2.193263\\nC -2.009446 0.587971 -2.193263\\nC 2.193263 -2.009446 -0.587971\\nC -2.597417 0.951357 -1.241906\\nC 0.653935 -2.960803 0.000000\\nC 1.241906 -2.597417 0.951357\\nC -0.653935 2.960803 0.000000\\nC -0.951357 1.241906 2.597417\\nC 0.587971 2.193263 -2.009446\\nC -0.587971 -2.193263 2.009446\\nC -2.597417 -0.951357 1.241906\\nC 2.193263 2.009446 0.587971\\nC 2.193263 2.009446 -0.587971\\nC -0.587971 2.193263 2.009446\\nC 2.597417 0.951357 1.241906\\nC 2.597417 0.951357 -1.241906\\nC -2.597417 -0.951357 -1.241906\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n",
       "\tviewer_16009887081744692.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.2}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.01}});\n",
       "\tviewer_16009887081744692.zoomTo();\n",
       "viewer_16009887081744692.render();\n",
       "});\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<py3Dmol.view at 0x7fe583391390>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# to improve the quality, you can increase the minimum distance\n",
    "from pyxtal.crystal import Tol_matrix\n",
    "tol = Tol_matrix.from_matrix([[1.2]])\n",
    "C60 = random_cluster('Ih', ['C'], [60], 1.0, tm=tol)\n",
    "C60.show(scale=0.2, radius=0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/3dmoljs_load.v0": "<div id=\"3dmolviewer_16009887081860852\"  style=\"position: relative; width: 600px; height: 300px\">\n        <p id=\"3dmolwarning_16009887081860852\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n        </div>\n<script>\n\nvar loadScriptAsync = function(uri){\n  return new Promise((resolve, reject) => {\n    var tag = document.createElement('script');\n    tag.src = uri;\n    tag.async = true;\n    tag.onload = () => {\n      resolve();\n    };\n  var firstScriptTag = document.getElementsByTagName('script')[0];\n  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n});\n};\n\nif(typeof $3Dmolpromise === 'undefined') {\n$3Dmolpromise = null;\n  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n}\n\nvar viewer_16009887081860852 = null;\nvar warn = document.getElementById(\"3dmolwarning_16009887081860852\");\nif(warn) {\n    warn.parentNode.removeChild(warn);\n}\n$3Dmolpromise.then(function() {\nviewer_16009887081860852 = $3Dmol.createViewer($(\"#3dmolviewer_16009887081860852\"),{backgroundColor:\"white\"});\n\tviewer_16009887081860852.addModel(\"60\\nC60\\nC -0.000000 0.653935 -2.960803\\nC -0.951357 1.241906 -2.597417\\nC 2.009446 0.587971 2.193263\\nC 2.009446 -0.587971 2.193263\\nC -1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 2.597417\\nC -0.587971 -2.193263 -2.009446\\nC 1.241906 2.597417 -0.951357\\nC 2.193263 -2.009446 0.587971\\nC 2.009446 0.587971 -2.193263\\nC -0.587971 2.193263 -2.009446\\nC 0.000000 0.653935 2.960803\\nC 2.960803 0.000000 0.653935\\nC 2.597417 -0.951357 1.241906\\nC 0.000000 -0.653935 2.960803\\nC -2.960803 0.000000 0.653935\\nC -2.597417 0.951357 1.241906\\nC -1.241906 2.597417 -0.951357\\nC -0.951357 -1.241906 2.597417\\nC 0.951357 1.241906 -2.597417\\nC 0.587971 -2.193263 2.009446\\nC -2.193263 -2.009446 -0.587971\\nC -2.193263 -2.009446 0.587971\\nC 0.587971 -2.193263 -2.009446\\nC -2.009446 -0.587971 2.193263\\nC -2.009446 0.587971 2.193263\\nC 0.587971 2.193263 2.009446\\nC 1.241906 -2.597417 -0.951357\\nC 0.951357 1.241906 2.597417\\nC -0.951357 -1.241906 -2.597417\\nC -1.241906 -2.597417 0.951357\\nC -0.000000 -0.653935 -2.960803\\nC 2.960803 -0.000000 -0.653935\\nC 0.653935 2.960803 0.000000\\nC 2.009446 -0.587971 -2.193263\\nC -2.193263 2.009446 -0.587971\\nC 2.597417 -0.951357 -1.241906\\nC -2.960803 -0.000000 -0.653935\\nC -0.653935 -2.960803 0.000000\\nC -1.241906 -2.597417 -0.951357\\nC -2.193263 2.009446 0.587971\\nC 1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 -2.597417\\nC -2.009446 -0.587971 -2.193263\\nC -2.009446 0.587971 -2.193263\\nC 2.193263 -2.009446 -0.587971\\nC -2.597417 0.951357 -1.241906\\nC 0.653935 -2.960803 0.000000\\nC 1.241906 -2.597417 0.951357\\nC -0.653935 2.960803 0.000000\\nC -0.951357 1.241906 2.597417\\nC 0.587971 2.193263 -2.009446\\nC -0.587971 -2.193263 2.009446\\nC -2.597417 -0.951357 1.241906\\nC 2.193263 2.009446 0.587971\\nC 2.193263 2.009446 -0.587971\\nC -0.587971 2.193263 2.009446\\nC 2.597417 0.951357 1.241906\\nC 2.597417 0.951357 -1.241906\\nC -2.597417 -0.951357 -1.241906\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n\tviewer_16009887081860852.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.1}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.01}});\n\tviewer_16009887081860852.zoomTo();\nviewer_16009887081860852.render();\n});\n</script>",
      "text/html": [
       "<div id=\"3dmolviewer_16009887081860852\"  style=\"position: relative; width: 600px; height: 300px\">\n",
       "        <p id=\"3dmolwarning_16009887081860852\" style=\"background-color:#ffcccc;color:black\">You appear to be running in JupyterLab (or JavaScript failed to load for some other reason).  You need to install the 3dmol extension: <br>\n",
       "        <tt>jupyter labextension install jupyterlab_3dmol</tt></p>\n",
       "        </div>\n",
       "<script>\n",
       "\n",
       "var loadScriptAsync = function(uri){\n",
       "  return new Promise((resolve, reject) => {\n",
       "    var tag = document.createElement('script');\n",
       "    tag.src = uri;\n",
       "    tag.async = true;\n",
       "    tag.onload = () => {\n",
       "      resolve();\n",
       "    };\n",
       "  var firstScriptTag = document.getElementsByTagName('script')[0];\n",
       "  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n",
       "});\n",
       "};\n",
       "\n",
       "if(typeof $3Dmolpromise === 'undefined') {\n",
       "$3Dmolpromise = null;\n",
       "  $3Dmolpromise = loadScriptAsync('https://3dmol.csb.pitt.edu/build/3Dmol.js');\n",
       "}\n",
       "\n",
       "var viewer_16009887081860852 = null;\n",
       "var warn = document.getElementById(\"3dmolwarning_16009887081860852\");\n",
       "if(warn) {\n",
       "    warn.parentNode.removeChild(warn);\n",
       "}\n",
       "$3Dmolpromise.then(function() {\n",
       "viewer_16009887081860852 = $3Dmol.createViewer($(\"#3dmolviewer_16009887081860852\"),{backgroundColor:\"white\"});\n",
       "\tviewer_16009887081860852.addModel(\"60\\nC60\\nC -0.000000 0.653935 -2.960803\\nC -0.951357 1.241906 -2.597417\\nC 2.009446 0.587971 2.193263\\nC 2.009446 -0.587971 2.193263\\nC -1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 2.597417\\nC -0.587971 -2.193263 -2.009446\\nC 1.241906 2.597417 -0.951357\\nC 2.193263 -2.009446 0.587971\\nC 2.009446 0.587971 -2.193263\\nC -0.587971 2.193263 -2.009446\\nC 0.000000 0.653935 2.960803\\nC 2.960803 0.000000 0.653935\\nC 2.597417 -0.951357 1.241906\\nC 0.000000 -0.653935 2.960803\\nC -2.960803 0.000000 0.653935\\nC -2.597417 0.951357 1.241906\\nC -1.241906 2.597417 -0.951357\\nC -0.951357 -1.241906 2.597417\\nC 0.951357 1.241906 -2.597417\\nC 0.587971 -2.193263 2.009446\\nC -2.193263 -2.009446 -0.587971\\nC -2.193263 -2.009446 0.587971\\nC 0.587971 -2.193263 -2.009446\\nC -2.009446 -0.587971 2.193263\\nC -2.009446 0.587971 2.193263\\nC 0.587971 2.193263 2.009446\\nC 1.241906 -2.597417 -0.951357\\nC 0.951357 1.241906 2.597417\\nC -0.951357 -1.241906 -2.597417\\nC -1.241906 -2.597417 0.951357\\nC -0.000000 -0.653935 -2.960803\\nC 2.960803 -0.000000 -0.653935\\nC 0.653935 2.960803 0.000000\\nC 2.009446 -0.587971 -2.193263\\nC -2.193263 2.009446 -0.587971\\nC 2.597417 -0.951357 -1.241906\\nC -2.960803 -0.000000 -0.653935\\nC -0.653935 -2.960803 0.000000\\nC -1.241906 -2.597417 -0.951357\\nC -2.193263 2.009446 0.587971\\nC 1.241906 2.597417 0.951357\\nC 0.951357 -1.241906 -2.597417\\nC -2.009446 -0.587971 -2.193263\\nC -2.009446 0.587971 -2.193263\\nC 2.193263 -2.009446 -0.587971\\nC -2.597417 0.951357 -1.241906\\nC 0.653935 -2.960803 0.000000\\nC 1.241906 -2.597417 0.951357\\nC -0.653935 2.960803 0.000000\\nC -0.951357 1.241906 2.597417\\nC 0.587971 2.193263 -2.009446\\nC -0.587971 -2.193263 2.009446\\nC -2.597417 -0.951357 1.241906\\nC 2.193263 2.009446 0.587971\\nC 2.193263 2.009446 -0.587971\\nC -0.587971 2.193263 2.009446\\nC 2.597417 0.951357 1.241906\\nC 2.597417 0.951357 -1.241906\\nC -2.597417 -0.951357 -1.241906\",\"xyz\",{\"doAssembly\": true, \"duplicateAssemblyAtoms\": true});\n",
       "\tviewer_16009887081860852.setStyle({\"sphere\": {\"colorscheme\": \"Jmol\", \"scale\": 0.1}, \"stick\": {\"colorscheme\": \"Jmol\", \"radius\": 0.01}});\n",
       "\tviewer_16009887081860852.zoomTo();\n",
       "viewer_16009887081860852.render();\n",
       "});\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<py3Dmol.view at 0x7fe581f8e5d0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C60.show(scale=0.1, radius=0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "@webio": {
   "lastCommId": null,
   "lastKernelId": null
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
